<?php

namespace app\store\service;

use app\store\model\ArticleCategory;

class ArticleCategoryService
{

    public function getArticleCategoryList($keyword)
    {   
        $store_id = session('store_id');

        $query =  ArticleCategory::withOutField('desc')->where('store_id',$store_id);

        if (!empty($keyword)){
           $query->whereLike('category_name',"%$keyword%");
        }

        $ArticleCategories = $query->paginate(10);
        
        return  $ArticleCategories;
        
    }

    public static function getArticleCategoryOption()
    {
        $categories = ArticleCategory::field('id,category_name')->where('status',1)->select();
        
        return  $categories;
        
    }


    public function findArticleCategory($id)
    {
        $ArticleCategory = ArticleCategory::withOutField('create_time,update_time')->find($id);
    
        
        return  $ArticleCategory;
        
    }

    
}